// import request from 'umi-request';
import request from '@/utils/Request';
import { stringify } from 'qs';

export async function login(params) {
  return request(`/joker/oauth/login`, {
    method: 'POST',
    params: {
      ...params
    }
  });
}

export async function register(params) {
  return request(`/joker/users/register`, {
    method: 'POST',
    params: {
      ...params
    }
  });
}

export async function getCurrentUser() {
  return request(`/joker/users/getCurrentUser`, {
    method: 'GET'
  });
}

export async function recordIp() {
  return request(`/joker/visitors/getIpAddress`, {
    method: 'GET'
  });
}

export async function saveUser() {
  return request(`/joker/users/saveUser`, {
    method: 'GET'
  });
}

export async function logout() {
  return request(`/joker/logout`, {
    method: 'GET'
  });
}

// headers:{
//   'Content-Type': 'application/x-www-form-urlencoded',
//     'authorization':`Bearer ${localStorage.getItem('token')}`
// }
